"""3.3 **循环结构—for循环的核心概念**
定义：
    循环就是重复做某件事，比如重复执行100次print
    循环的作用：让代码更高效的重复执行
循环的分类：
    for循环
    while循环

"""
# for in 列表
fruits = ["苹果","香蕉","西瓜","草莓"]
for fruit in fruits:
    print(fruit)

# for ... in 字符串
str = "hello,world"
for s in str:
    print(s)

#for ... in 字典
dict = {"name":"zhangsan","age":18}
for key in dict:
    print(key)
    print(dict[key])
print("-------------------------")
for key,value in dict.items():
    print(key,value)
# for... in range
print(" ----- range(一个参数)----------")
for i in range(10):
    print(i)

print(" ----- range(两个参数)----------")
for i in range(1,10):
    print(i)

print(" ----- range(三个参数)----------")
# i=i+2
for i in range(1,10,2):
    print(i)

# for ...range嵌套
print(" ----- for...range嵌套----------")
for i in range(5):
    for j in range(5):
        print(i,j)

